Thread: int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow) {

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    319

    int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow) {

    int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow)

    what are these 4 parameters for , i always see them

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    The first one, hInst, is needed for creating windows, controls etc. and much more. But you can always use GetModuleHandle(NULL) anywhere you need to put a HISTANCE.
    hPrevInst is for console programs mostly (instance of the last console program in the same window).
    lpCmd is the command line for the program (for parameters).
    nShow is needed for ShowWindow(windowhandle,nShow).
    I assume you didn't understand anything in my explanations. I am so bad explanator.

  4. #4
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    hPrevInst is for console programs mostly (instance of the last console program in the same window).
    Actually hPrevInst is depreciated, and always NULL.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can some one please tell me the cause of the error ?
    By broli86 in forum C Programming
    Replies: 8
    Last Post: 06-26-2008, 08:36 PM
  2. Replies: 8
    Last Post: 03-10-2008, 11:57 AM
  3. Moving Average Question
    By GCNDoug in forum C Programming
    Replies: 4
    Last Post: 04-23-2007, 11:05 PM
  4. Working with random like dice
    By SebastionV3 in forum C++ Programming
    Replies: 10
    Last Post: 05-26-2006, 09:16 PM
  5. A Simple (?) Problem
    By Unregistered in forum C++ Programming
    Replies: 8
    Last Post: 10-12-2001, 04:28 AM